<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<script>
			const builder = function* (arr) {
				for (let item of arr) {
					yield item;
				}
			}
			const gen = builder([1, 2, 3]);
			console.log(gen.next().value);
			setTimeout(() => {
				console.log(gen.next().value);
				console.log(gen.next().value);
			}, 2000)
		</script>
	</body>
</html>